package com.ktjy.service.impl;

import com.ktjy.mapper.SysUserMapper;
import com.ktjy.pojo.SysUser;
import com.ktjy.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    SysUserMapper sysUserMapper;

    @Override
    public int count(String realName, Integer queryRoleId) {
        int count = sysUserMapper.count(realName, queryRoleId);
        return count;
    }

    @Override
    public List<SysUser> getUserListByParams(String realName, Integer roleId, Integer pageBegin, Integer pageSize) {
        List<SysUser> userListByParams = sysUserMapper.getUserListByParams(realName, roleId, (pageBegin - 1) * pageSize, pageSize);
        return userListByParams;
    }

    @Override
    public SysUser login(String account, String password) {
        SysUser login = sysUserMapper.login(account, password);
        return login;
    }

    @Override
    public SysUser selectAccount(String account) {
        SysUser sysUser = sysUserMapper.selectAccount(account);
        return sysUser;
    }

    @Override
    public int insert(SysUser sysUser) {
        int insert = sysUserMapper.insert(sysUser);
        return insert;
    }

    @Override
    public SysUser selectById(Integer id) {
        SysUser user = sysUserMapper.selectById(id);
        return user;
    }

    @Override
    public int delete(Integer id) {
        int delete = sysUserMapper.delete(id);
        return delete;
    }

    @Override
    public int updateXX(SysUser sysUser) {
        int i = sysUserMapper.updateXX(sysUser);
        return i;
    }

    @Override
    public int UpdatePwd(String pwd, String jpwd, Integer id) {
        int i = sysUserMapper.UpdatePwd(pwd, jpwd, id);
        return i;
    }


}
